package com.shujia.wyh.day24;

import java.io.*;

/*
        字符缓冲输入流

 */
public class BufferedReaderDemo1 {
    public static void main(String[] args) throws IOException {
//        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("d.txt")));
        BufferedReader br = new BufferedReader(new FileReader("d.txt"));
        //一次读一个字符
//        int ch = 0;
//        while ((ch=br.read())!=-1){
//            System.out.print((char) ch);
//        }
        System.out.println("===============================");
        //一次读取一个字符数组
        char[] chars = new char[1024];
        int length = 0;
        while ((length=br.read(chars))!=-1){
            String s = new String(chars, 0, length);
            System.out.println(s);
        }




        //释放资源
        br.close();
    }
}
